<div id="error"></div>
   
<script language="javascript">
    // apply filters
    jQuery(document).ready(function(){
        jQuery("#list").jqGrid({
            url: '<?php echo site_url() ?>/pendienteen/data',
            mtype: 'POST',
            datatype: 'json',
            colNames:['ID','Referencia','Servicio','C. Servicio','Telefono','Mail','Contacto','Usuarios','Dias'],
            colModel :[ 
                {name:'idPendientes', index:'Id_Pendientes', width:2,hidden:true},
                {name:'referencia', index:'Referencia', width:50},
                {name:'servicio', index:'Id_Servicio', width:30},
                {name:'cservicio', index:'clasificacion_servicios', width:30},  
                {name:'telefono', index:'Telefono1', width:30},
                {name:'mail', index:'Email', width:50},
                {name:'contacto', index:'Contacto', width:30},
                {name:'usuarios', index:'Id_Usuario', width:30},
                {name:'dias', index:'date', width:15}
                ],
            pager: jQuery('#pager'),
            hiddengrid: false,
            sortname: 'Id_Pendientes',
            rowNum:10,
            rowList:[10,20,30,40,50],
            sortorder: "asc",
            height: '100%',
            width: '650',
            imgpath: _base_url + 'public/css/jqgrid/flex/images',
            viewrecords: true,
            multiselect: true,
            adjacents: 4,

            jsonReader: { repeatitems : false, idPendientes: "0" }
        }).navGrid('#pager',{add:false,del:false,edit:false,search:false,position:"left"})
       
        .navButtonAdd('#pager',{caption:"", buttonimg: _base_url + "public/css/jqgrid/flex/images/text_columns.png", onClickButton:function(){ jQuery("#list").setColumns();} })  
        .navButtonAdd('#pager',{caption:"G. Entrega", buttonimg: _base_url + "public/images/new.png", onClickButton:function(){ var id = jQuery('#list').getGridParam('selarrrow');
        if (id.length > 0) {
            if(id.length == 1){
                var ret = jQuery("#list").getRowData(id);
                window.location = _site_url + '/pendienteen/add/' +ret.idPendientes;
            } else { jAlert('Seleccione solo un registro'); }
        } else { jAlert('Debe seleccionar al menos un registro'); }
        return false; } })
        

        ; $('#apply_filter').bind('click', applyFilter);
    }); 

   
    
    var flAuto = true;
    var timeoutHnd; 

    function doSearch(ev)
    { 
          if(!flAuto) return; 
          // var elem = ev.target||ev.srcElement; 
          if(timeoutHnd) 
              clearTimeout(timeoutHnd) 
              timeoutHnd = setTimeout(gridReload,500) 
    } 
     
    function enableAutosubmit(state)
    { 
          flAuto = state; 
          jQuery("#submitButton").attr("disabled",state); 
    }
    
    function gridReload()
    { 
          var nm_mask = jQuery("#item_nm").val(); 
     
          var cd_mask = jQuery("#search_cd").val(); 

       
          
          jQuery("#list").setGridParam({url :'<?php echo site_url() ?>/pendienteen/data/'+cd_mask, page : 1}).trigger('reloadGrid'); 
    }  
</script>

  
<div class="table_container">
<table>
    <tr>
    	<td><div id="titulo">Sociedades Pendientes Para Entregas</div></td>
    </tr>
    <tr>
       <td style="background: #D9E6F0;border: 1px solid #C3AA64; height: 23px">&nbsp;<b>Referencia:<b/> <input type='text' background='#ff22ff' id='search_cd' onkeydown='doSearch(arguments[0]||event)' style='height:13px;font-size:2;color:#ff00ff;' size='10'/></td>
    </tr>
    <tr>
        <td>
            <table id="list" class="scroll"></table>
            <div id="pager" class="scroll" style="text-align:center;"></div>
        </td>
	</tr>
 </table>
</div>